{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<style type="text/css">
		.mask .mask-content{height: 17vh}
		.img-1{height: 80px !important;width: 80px!important;}
		.gray{background: rgba(235,235,235,0.5);}
	</style>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd><form method="get"><input type="text" class="input" placeholder="请输入您需要搜索的产品名称！" name="search"><input type="submit" value="搜索" class="button" /></form></dd>
			</dl>
		</div>
		<div class="content">
			
			<table class="table">
				<thead><th width="15%">图片</th><th width="15%">品牌</th><th width="25%">货号名称</th><th width="15%">销量</th><th width="15%">销售额</th><th width="15%">关注浏览数量</th></thead>
				{{range .info}}
				<tr id="{{.id}}">
					<td class="center"><img src="{{.pathname}}" class="img-1"></td>
					<td>
						{{.bname}}
					</td>
					<td>
						{{.title}}({{.barcode}})
					</td>
					<td>
						{{if .sellnum}}{{.sellnum}}{{else}}0{{end}}
					</td>
					<td>
						&yen;{{.allmoney}}
					</td>
					<td>
						关注:{{if .focus}}{{.focus}}{{else}}0{{end}}  浏览:{{if .click}}{{.click}}{{else}}0{{end}}
					</td>
				</tr>
				{{end}}
				{{if ne .paginator.totalpages 1}}
					<tr>
						<td  colspan="6">
							<div class="paging">
								{{if ne .paginator.currpage 1}}
								<a href="{{$.url}}page={{.paginator.firstpage}}">首页</a>
								<a href="{{$.url}}page={{.paginator.prevpage}}">&lt;&lt;</a>
								{{else}}
								<a class="disable">首页</a>
								<a class="disable">&lt;&lt;</a>
								{{end}}
								{{range $index,$page := .paginator.pages}}
								{{if eq $.paginator.currpage $page}} 
								<a class="no">{{$page}}</a>
								{{else}}
								<a href="{{$.url}}page={{$page}}">{{$page}}</a>
								{{end}}
								{{end}}
								{{if eq .paginator.currpage .paginator.totalpages}}
								<a class="disable">&gt;&gt;</a>
								<a class="disable">尾页</a>
								{{else}}
								<a href="{{$.url}}page={{.paginator.nextpage}}">&gt;&gt;</a>
								<a href="{{$.url}}page={{.paginator.totalpages}}">尾页</a>
								{{end}}
							</div>
						</td>
					</tr>
				{{end}}
			</table>


		</div>
<div class="mask">
		<div class="mask-content">
			<form id="parameter">
				<table class="table1">
					<thead><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th></thead>
					<tr>
						<td class="genre" colspan="2">店铺id</td>
						<td colspan="6">
							<input type="text" class="input70" placeholder="需要复制过去的店铺id" name="gid" list="gid">
							<datalist id="gid">
							</datalist>
							<button type="button" class="inputbutton" data-type="shop">搜索店铺</button>
						</td>
					</tr>
				</table>
				<input type="hidden" name="id">
			</form>
			<p id="tip"></p>
			<div class="mask-form">
				<dl>
					<dt>
						<button id="qr">保存</button>
						<button id="cancle">取消</button>
					</dt>
					<dd>
					</dd>
				</dl>
			</div>
		</div>
	</div>
	</article>
</section>
<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
    $('.del').click(function(){
		var id=$(this).attr('data-id');
		wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/del',
				data:{table:'mt_product',id:id},
				type:'get',
				success:function(res) {
					if(res==1){
						showMessage('删除成功');
						$('#'+id).css('display','none');
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		}});
	})
	$('.copy').click(function(){
		var id=$(this).attr('data-id')
		$('#parameter').find('input[name="id"]').val(id)
		$('.mask').css('display','block')
	})
	$('#cancle').click(function(){
		$('#money').val('')
		$('.mask').css('display','none')
	})
	$('#qr').click(function(){
		if($('input[name="gid"]').val()==''){
			showMessage('请输入店铺id');
			return
		}
		var form=$('#parameter').serialize()
		$.ajax({
			url:'/admin/product/copy',
			data:form,
			success:function(res){
				if(res==1){
					$('.mask').css('display','none')
					wxc.xcConfirm("复制成功","success");
				}else{
					wxc.xcConfirm("操作失败,请重试","error");
				}
			}
		})
	})
	$('.change').click(function(){
		var id=$(this).attr('data-id');
		var status=$(this).attr('data-status');
		var that=$(this)
		// wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/change',
				data:{table:'mt_product',id:id,status:status},
				type:'get',
				success:function(res) {
					if(res.status==1){
						that.html(res.info)
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		// }});
	})
</script>
</body>
</html>
